<template>
  <div class="chart">
    <div v-if="widgetData.value.bgImg!==''" class="titleBox">
      <div class="img"><img :src="widgetData.value.bgImg"></div>
      <div class="title"><span>{{widgetData.value.title}}</span></div>
    </div>
    <div v-else class="titleBox">
      <i class="el-icon-picture"></i>
      <div class="title"><span>{{widgetData.value.title}}</span></div>
    </div>

    <div class="dataBox">
      <div class="item" v-for="(item,idx) in widgetData.value.countData" :key="idx">
        <div class="value"><span>{{item.value}}</span></div>
        <div class="img">
          <img v-if="item.img!=''" :src="item.img">
          <i v-else class="el-icon-picture seat"></i>
        </div>
        <div class="label"><span>{{item.label}}</span></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  props: ['widgetData'],
  computed: {},
  data () {
    return {}
  },
  watch: {},
  created () {},
  mounted () {},
  methods: {},
}
</script>

<style lang="less" scoped>
.chart {
  width: 100%;
  height: 100%;
  span{
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .titleBox{
    width: 100%;
    height: 40px;
    position: relative;
    .img{
      width: 100%;
      height: 40px;
      position: absolute;
      img{
        width: 100%;
        height: 100%;
      }
    }
    .title{
      position: absolute;
      width: 100%;
      height: 40px;
      line-height: 40px;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      padding: 13px;
      font-size: 18px;
      color: #FFFFFF;
      background-color: #000;
    }
    .el-icon-picture{
      width: 100%;
      height: 40px;
      position: absolute;
      font-size: 3.125rem;
      background: #ffffff;
      color: #c1c1c1;
      display: flex;
      justify-content: center;
      align-items: center;
    }
  }
  .dataBox{
    width: 100%;
    height: calc(100% - 40px);
    display: flex;
    justify-content: space-around;
    .item{
      width: 100%;
      padding: 15px 5px 0;
      text-align: center;
      display: flex;
      align-items: center;
      flex-direction: column;
      .label{
        width: 100%;
        color: #fff;
        font-size: 18px;
        font-weight: bold;
      }
      .value{
        width: 100%;
        color: #fff;
        font-size: 18px;
      }
      .img{
        width: 50%;
        height: 30%;
        margin: 10px 0;
      }
      .seat{
        width: 100%;
        height: 100%;
        font-size: 30px;
        background: #ffffff;
        display: flex;
        justify-content: center;
        align-items: center;
      }
    }
  }
}
</style>